# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=libdvdnav
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=5.0.3
pkgrel=1
pkgdesc="The library for xine-dvdnav plugin (mingw-w64)"
arch=('any')
url="http://dvdnav.mplayerhq.hu/"
license=("GPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-doxygen"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "git")
depends=("${MINGW_PACKAGE_PREFIX}-libdvdread")
options=('staticlibs' 'strip')
source=("${_realname}-${pkgver}"::"git+https://git.videolan.org/git/${_realname}.git#tag=${pkgver}"
        #"https://www.videolan.org/pub/videolan/${_realname}/${pkgver}/${_realname}-${pkgver}.tar.bz2"
        001-no-undefined.patch)
sha256sums=('SKIP'
            '95a36364e015ef0a1e765d167c69e1bcb643bbcc0e9036ae0bc0b54145c07190')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}
  patch -p1 -i ${srcdir}/001-no-undefined.patch
  autoreconf -fvi
}

build() {
  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-shared \
    --enable-static \
    --disable-doc
  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
}
